Skip to content

Add server-logic, cloud-flow, integrate-backend skills and plugin version check - #57

Merged
Priyanshu Agrawal (priyanshu92) merged 36 commits into
mainfrom
users/suyashpatel/server-logic-skill
Apr 9, 2026
Merged

Add server-logic, cloud-flow, integrate-backend skills and plugin version check#57
Priyanshu Agrawal (priyanshu92) merged 36 commits into
mainfrom
users/suyashpatel/server-logic-skill

Conversation

@suyash1208

@suyash1208 Suyash Kumar Patel (suyash1208) commented Mar 25, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Adds three new Power Pages skills: add-server-logic, add-cloud-flow, and integrate-backend
  • Adds plugin version check that runs at the start of every Power Pages skill, showing update commands when a newer version is available on origin/main
  • Adds CI workflow to auto-enforce the version check line in new skills

New skills

  • add-server-logic: Creates server-side JavaScript endpoints running on the Power Pages runtime, with YAML metadata generation and validation
  • add-cloud-flow: Connects Power Automate cloud flows with PowerPages triggers to a code site, including flow discovery, metadata scaffolding, and plan rendering
  • integrate-backend: Meta skill that orchestrates backend integration by routing to the appropriate sub-skill based on the use case

Plugin version check

  • scripts/check-version.js compares local plugin.json version against origin/main and prints marketplace + plugin update commands if remote is newer
  • Every SKILL.md includes a > **Plugin check** instruction that runs the script before starting any phase
  • AGENTS.md updated with the convention so new skills include it
  • CI workflow (ensure-skill-version-check.yml) uses the GitHub App to auto-add the version check line to any SKILL.md missing it on PRs

What's included

  • SKILL.md files for all three new skills with phase-based workflows
  • Validation scripts (validate-serverlogic.js, validate-cloudflow.js) with stop-hook integration
  • Metadata generators (create-serverlogic-metadata.js, create-cloud-flow-metadata.js) with YAML-safe serialization
  • Plan renderers (render-serverlogic-plan.js, render-cloudflow-plan.js, render-backend-plan.js) with HTML template support
  • Flow discovery (list-cloud-flows.js) using the Power Automate Flow RP API
  • Version check (check-version.js) with test coverage (check-version.test.js)
  • CI enforcement (ensure-skill-version-check.js + GitHub Actions workflow)
  • Test coverage for all new scripts
  • Shared infrastructure updates: centralized hook validation, render-template utility, powerpages-hook-utils tracking

Test plan

  • Invoke /add-server-logic on a deployed Power Pages code site
  • Verify server logic with external API (HttpClient) and Dataverse CRUD paths
  • Invoke /add-cloud-flow and verify flow discovery, metadata creation, and plan rendering
  • Invoke /integrate-backend and verify routing to sub-skills
  • Verify validation scripts catch: missing try/catch, browser APIs, console.log, disallowed functions
  • Verify .serverlogic.yml and .cloudflowconsumer.yml have valid UUIDs and web role GUIDs
  • Run any skill with a downgraded plugin.json version and confirm update notice appears
  • Deploy and test endpoints end-to-end

🤖 Generated with Claude Code

Suyash Kumar Patel and others added 4 commits March 19, 2026 22:20
New skill that orchestrates creating Power Pages Server Logic — server-side
JavaScript that runs securely on the Power Pages runtime. Includes:

- 9-phase workflow: verify site, gather requirements, fetch Microsoft Learn
  docs (source of truth), review plan, implement, configure site settings,
  client-side integration, verify/test guidance, review/deploy
- Validation script (stop hook) that checks .js file structure, allowed
  functions, error handling, and prohibited APIs
- Explore agent integration to discover existing server logics and frontend
  patterns before implementation
- Client-side integration phase with framework-specific patterns
  (shell.safeAjax, powerPagesApi.ts, standalone fetch)
- Microsoft Learn MCP tools in allowed tools for dynamic doc discovery
- Reference file for documentation discovery strategy
- Skill tracking registered as IntegrateServerlogic

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Based on testing feedback, update the integrate-serverlogic skill:

- Server logic files now live in .powerpages-site/server-logic/<name>/
  with two files: <name>.js (code) and <name>.serverlogic.yml (metadata)
- .powerpages-site folder is now a mandatory prerequisite (not optional)
- YAML metadata includes id (UUID), web roles, display name, description
  with alphabetically sorted fields to match PAC CLI conventions
- Phase 5 now reads web roles from .powerpages-site/web-roles/ to
  populate adx_serverlogic_adx_webrole array
- Explore agent updated to search .powerpages-site/server-logic/ and
  read web role files
- Validation script updated to check new file locations, YAML structure,
  UUID validity, and non-empty web role array
- Removed redundant deployment check in Phase 6 (already enforced in
  Phase 1.5)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Server.Connector.Dataverse respects table permissions — without them,
the connector silently returns 0 records. Added Phase 6 (conditional)
that:

- Parses the server logic .js to detect which Dataverse tables are
  accessed and what CRUD operations are performed
- Launches the table-permissions-architect agent to create table
  permission YAML files in .powerpages-site/table-permissions/
- Only runs when Server.Connector.Dataverse is used; skipped for
  HttpClient-only server logics

Also updated:
- Phase 4 plan table: shows table permissions needed upfront
- Phase 10.2 summary: includes table permissions row
- Phase 10.4 post-deploy: specific guidance about table permissions
- Stop hook: verifies table permissions were configured
- Key decision points and progress tracking table

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…kill

Two gaps mitigated vs integrate-webapi skill:

1. Web role creation (Phase 5.2): If no web roles exist, the skill
   now creates default roles (Authenticated Users, Anonymous Users,
   Administrators) using create-web-role.js before writing the
   server logic YAML. Previously only read existing roles.

2. Permission source choice (Phase 6.2): Added Path A (user-provided
   permissions diagram) alongside existing Path B (let architect
   analyze). Path A parses user diagrams and creates permissions
   via deterministic scripts, matching how integrate-webapi handles
   this. Path B now explicitly instructs the architect agent to
   create missing web roles if needed.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings March 25, 2026 17:01

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new Power Pages skill (integrate-serverlogic) to orchestrate authoring and deploying Server Logic, including documentation discovery and stop-hook validation.

Changes:

  • Introduces integrate-serverlogic skill orchestration with a 10-phase workflow and stop-hook checks.
  • Adds a Node.js validation script to verify generated Server Logic .js and .serverlogic.yml outputs.
  • Adds a Microsoft Learn discovery reference and updates skill tracking reference.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 6 comments.

File Description
plugins/power-pages/skills/integrate-serverlogic/scripts/validate-serverlogic.js Adds a stop-hook validator for Server Logic folders, JS constraints, and YAML metadata checks.
plugins/power-pages/skills/integrate-serverlogic/references/server-logic-docs.md Documents dynamic Microsoft Learn discovery strategy for Server Logic docs.
plugins/power-pages/skills/integrate-serverlogic/SKILL.md Adds the full 10-phase orchestration for creating Server Logic and integrating it into a site.
plugins/power-pages/references/skill-tracking-reference.md Registers the new skill for tracking (IntegrateServerlogic).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread plugins/power-pages/skills/integrate-serverlogic/scripts/validate-serverlogic.js Outdated
Comment thread plugins/power-pages/skills/integrate-serverlogic/scripts/validate-serverlogic.js Outdated
Comment thread plugins/power-pages/skills/integrate-serverlogic/scripts/validate-serverlogic.js Outdated
Comment thread plugins/power-pages/skills/integrate-serverlogic/scripts/validate-serverlogic.js Outdated
Comment thread plugins/power-pages/skills/integrate-serverlogic/scripts/validate-serverlogic.js Outdated
Comment thread plugins/power-pages/skills/integrate-serverlogic/scripts/validate-serverlogic.js Outdated
- 🔧 Changed command references from `/power-pages:create-site` to `/create-site`.
- 🔧 Updated prompt messages to reflect new command structure.
- 🔧 Adjusted deployment instructions for consistency.

-Priyanshu
Copilot AI review requested due to automatic review settings March 26, 2026 09:29

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 7 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread plugins/power-pages/skills/integrate-serverlogic/scripts/validate-serverlogic.js Outdated
Comment thread plugins/power-pages/skills/integrate-serverlogic/SKILL.md Outdated
Comment thread plugins/power-pages/skills/integrate-serverlogic/SKILL.md Outdated
Comment thread plugins/power-pages/skills/integrate-serverlogic/scripts/validate-serverlogic.js Outdated
Comment thread plugins/power-pages/skills/integrate-serverlogic/scripts/validate-serverlogic.js Outdated
Comment thread plugins/power-pages/skills/integrate-serverlogic/scripts/validate-serverlogic.js Outdated
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Add explicit user confirmation before running /test-site after deployment,
include tracking file commit guidance, and bump power-pages plugin version.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings March 26, 2026 18:41

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 15 out of 15 changed files in this pull request and generated 4 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread plugins/power-pages/skills/integrate-serverlogic/scripts/validate-serverlogic.js Outdated
Comment thread plugins/power-pages/skills/integrate-serverlogic/SKILL.md Outdated
Comment thread plugins/power-pages/skills/add-server-logic/SKILL.md Outdated
- Fix early approve() calls to return so execution terminates
- Add fetch to disallowed browser APIs list
- Scope web role GUID validation to adx_serverlogic_adx_webrole section
- Strip YAML quotes before validating UUIDs and name fields
- Require name field in serverlogic.yml (fail if missing)
- Detect disallowed top-level functions outside the allowlist
- Expand try/catch detection to full function body instead of 100-char window
- Fix console.* error message to match the actual regex check
- Surface filesystem errors in findServerLogicDirs instead of swallowing
- Add path traversal guard on --name in create-serverlogic-metadata.js
- Fix phase cross-reference (Phase 7 -> Phase 8) in SKILL.md
- Renumber Phase 8 subsections (8.5/8.6 -> 8.3/8.4)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- ✏️ Update SKILL.md to clarify async function usage with Dataverse.
- ✅ Add validation tests for server logic functions, including checks for async/await usage and error handling.
- 📝 Implement detailed error messages for validation failures.

-Priyanshu
Copilot AI review requested due to automatic review settings March 30, 2026 08:00

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 16 out of 16 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread plugins/power-pages/skills/add-server-logic/scripts/validate-serverlogic.js Outdated
Priyanshu Agrawal and others added 2 commits April 1, 2026 11:15
- Rename skills/integrate-serverlogic/ to skills/add-server-logic/
- Update skill name in SKILL.md frontmatter
- Update all path references in SKILL.md, frontend-integration-reference.md
- Update skill key and validator path in powerpages-hook-utils.js
- Update skill name in render-serverlogic-plan.js
- Update tracking reference (skill name, PascalCase, setting name)
- Update skill name in test files

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings April 1, 2026 05:55

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 16 out of 16 changed files in this pull request and generated 4 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread plugins/power-pages/skills/add-server-logic/SKILL.md Outdated
Comment thread plugins/power-pages/skills/add-server-logic/scripts/validate-serverlogic.js Outdated
Priyanshu Agrawal and others added 2 commits April 2, 2026 13:36
The top-level function regex now uses ^...gm anchoring so nested helper
functions inside handlers are no longer flagged as disallowed.
create-serverlogic-metadata.js now single-quotes description and
display_name to handle special characters safely.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…support

New add-cloud-flow skill that connects Power Automate flows to Power Pages
sites. Key behaviors beyond basic flow registration:
- Analyzes user intent to suggest the most relevant flows instead of a flat list
- Supports re-integrating already-registered flows into additional pages
  without re-creating metadata (integration-only path skips Phases 4-6)
- Guides users to Power Automate when no flows with a PowerPages trigger exist

Also adds hook registration, skill tracking, cloudflow plan renderer,
render-template dataObject support, and hook debug logging.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Priyanshu Agrawal and others added 4 commits April 8, 2026 14:44
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Standalone script that compares local plugin.json version against
origin/main and prints update commands (marketplace + plugin) if
a newer version is available.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Each skill now runs check-version.js before starting and shows an
update notice if the remote has a newer plugin version. Added the
convention to AGENTS.md and cleaned up hooks.json format.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
GitHub Actions workflow using the GitHub App to auto-add the
version check line to any SKILL.md missing it on PRs.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@priyanshu92 Priyanshu Agrawal (priyanshu92) changed the title Add add-server-logic, add-cloud-flow, and integrate-backend skills Add server-logic, cloud-flow, integrate-backend skills and plugin version check Apr 8, 2026
Show a Key Vault banner in the plan overview and per-card secret
chips when the user chooses Azure Key Vault for secret management.
Move the Key Vault decision from Phase 7 to Phase 2.3.1 so it is
known before the plan is rendered.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings April 8, 2026 09:28

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 61 out of 61 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread .github/workflows/ensure-skill-version-check.yml Outdated
Comment thread plugins/power-pages/scripts/store-keyvault-secret.js Outdated
Priyanshu Agrawal and others added 2 commits April 8, 2026 15:14
- Replace regex-based top-level function detection with brace-depth
  scan to avoid false positives on nested helper functions
- Improve return validation to check for string-compatible values
  (string literals, JSON.stringify, String()) per handler
- Add HTML-escape helper for user-provided values rendered via
  innerHTML in the Key Vault plan section
- Update Key Decision Points to reference Phase 2.3.1 for the
  Key Vault decision (moved from Phase 7.1 in prior commit)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
store-keyvault-secret.js: Write the secret to a temp file (mode 0600)
and pass --file to az CLI instead of --value, so the secret never
appears in az process arguments. Support reading the secret from
stdin (preferred) alongside the existing --secretValue flag.

ensure-skill-version-check.yml: Guard the auto-fix-and-push path
behind github.event.pull_request.head.repo.fork == false. Fork PRs
run the script in --check mode for a clear failure message without
requiring repository secrets or write access.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings April 8, 2026 09:49
…RL validation

- Remove unused SITE_NAME JS variable from backend-plan.html and
  cloud-flow-plan.html script blocks (eliminates unescaped string
  placeholder in JS context)
- Add esc() HTML-escape helper to both templates for safe innerHTML
- Strengthen cloudflow validator to reject empty flowapiurl and
  flowtriggerurl values, with test coverage

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 61 out of 61 changed files in this pull request and generated 4 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread scripts/ensure-skill-version-check.js
Priyanshu Agrawal and others added 2 commits April 8, 2026 15:25
The flowtriggerurl field is always '' in real Power Pages cloud flow
consumer YAML — only validate that the key is present, not that it
has a value. Keep the non-empty check for flowapiurl only.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Fetch existing Custom APIs and Custom Process Actions from the user's
Dataverse environment so server logic can wrap them via InvokeCustomApi
instead of building equivalent logic from scratch.

- New script: list-custom-actions.js queries both customapis and
  workflows (category=3) tables with auth/retry support
- SKILL.md Phase 2.1.2: discover actions, present to user, map to
  server logic items
- SKILL.md Phase 5.3: code templates for unbound actions, entity-bound
  actions, and unbound functions
- HTML plan: purple "Custom Action" badge and detail box on cards that
  wrap an existing action
- Plan data format: optional customAction field on SERVER_LOGICS_DATA
- integrate-backend: Phase 1.3 discovers actions during site scan,
  factors them into approach recommendation and skill routing
- Decision framework: expanded Custom API entry and intent mapping

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings April 8, 2026 12:03

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 62 out of 62 changed files in this pull request and generated 5 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread scripts/ensure-skill-version-check.js Outdated
Comment thread plugins/power-pages/scripts/list-custom-actions.js
Comment thread plugins/power-pages/scripts/tests/list-cloud-flows.test.js Outdated
Priyanshu Agrawal and others added 2 commits April 8, 2026 19:19
- Fix frontmatter parsing in ensure-skill-version-check.js to use line-based
  regex instead of indexOf, handling CRLF and avoiding false matches
- Reject newline characters in yamlStr() for both serverlogic and cloudflow
  metadata scripts to prevent invalid YAML generation
- Accept optional catch binding syntax (catch { }) in validator
- Strip comments and string literals before disallowed-token checks in
  validator to prevent false positives
- Add HTTPS URL validation in list-custom-actions.js before passing to
  getAuthToken() to prevent shell injection
- Fix header comment in list-cloud-flows.js to match actual output shape
- Remove duplicate test in list-cloud-flows.test.js

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Mermaid v11 prefixes node IDs with the SVG element ID (e.g.
"erSvg1-entity-CONTACT-0"), so the anchored regex ^entity-
never matched. Remove the ^ anchor, use .outer-path selector
for the header group, and color divider strokes to match status.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings April 8, 2026 16:27

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 63 out of 63 changed files in this pull request and generated 5 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread plugins/power-pages/AGENTS.md
Comment thread scripts/ensure-skill-version-check.js
@priyanshu92
Priyanshu Agrawal (priyanshu92) merged commit 1ed4fef into main Apr 9, 2026
10 checks passed
@priyanshu92
Priyanshu Agrawal (priyanshu92) deleted the users/suyashpatel/server-logic-skill branch April 9, 2026 13:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants